#define _CRT_SECURE_NO_WARNINGS 
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int p[30000];	
int main()
{
	int w,n;
	int s = 0;
	scanf("%d%d", &w,&n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &p[i]);
	}
	sort(p, p + n);
	for (int x = 0, y = n - 1; x <= y; y--)
	{
		if (p[x] + p[y] <= w)
		{
			s++;
			x++;
		}
		else
		{
			s++;
		}
	}
	printf("%d", s);
	return 0;
}